netbird: switch to profile-based configuration
authorWesley Gimenes <[email protected]>
Tue, 26 Aug 2025 20:01:14 +0000 (17:01 -0300)
committerWesley Gimenes <[email protected]>
Wed, 10 Sep 2025 22:09:49 +0000 (19:09 -0300)
Add support for `netbird` profiles feature [1] (introduced in 0.52.2). Use
`NB_STATE_DIR="/root/.config/netbird"` in the init file instead of the
previous `NB_CONFIG="/etc/netbird/config.json"`, and update Makefile
configuration paths accordingly.

Rationale: `netbird` saves state/configuration under `/var` by default. On
OpenWrt, `/var` is a symlink to `/tmp` (a volatile location), which would
cause config loss after reboot or reflash. Using `/root/.config/netbird`
avoids this, it's a valid upstream directory not used by default.
`netbird` will migrate existing configurations.

This change will not be backported to preserve the current meaning of
"stable" in OpenWrt and to avoid (unlikely but possible) breakage of
existing installations.

[1]: https://docs.netbird.io/how-to/profiles

Signed-off-by: Wesley Gimenes <[email protected]>
net/netbird/Makefile
net/netbird/files/netbird.init

index 4714f7de3f1955197741079db8b8d119064dfba6..d26e66fdd3796bd8f16636b61ff771cd708fe678 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=netbird
 PKG_VERSION:=0.55.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/netbirdio/netbird/tar.gz/v$(PKG_VERSION)?
@@ -41,7 +41,7 @@ define Package/netbird/description
 endef
 
 define Package/netbird/conffiles
-/etc/netbird/config.json
+/root/.config/netbird/
 endef
 
 define Package/netbird/install
index b5a0930c5a403e059be968caf716c7bb4c6551ab..84ad6912850b2a1ba555ad3501f03beff2b09d38 100755 (executable)
@@ -8,7 +8,7 @@ USE_PROCD=1
 start_service() {
        procd_open_instance
        procd_set_param command /usr/bin/netbird
-       procd_set_param env NB_CONFIG="/etc/netbird/config.json"
+       procd_set_param env NB_STATE_DIR="/root/.config/netbird"
        procd_append_param command service run
        procd_set_param pidfile /var/run/netbird.pid
        procd_close_instance